#-Desc: ssl证书模块
#-Author: fxl0206
H=localhost

init: #在当前目录初始化san #
	@mkdir -p ./certs && \
	cp ${toolHome}/files/san.cnf ./san.cnf
gen: #基于san生成证书和key #
	@rm -rf ./certs/domain.*
	@openssl req -new -newkey rsa:4096 -config san.cnf -nodes -subj "/" -outform pem -out certs/domain.csr -keyout certs/domain.key
	@openssl x509 -req -days 365 -in certs/domain.csr -signkey certs/domain.key -out certs/domain.crt -outform pem -extensions v3_req -extfile san.cnf

pwd: #生成htpaaswd # US=? PS=?
	htpasswd -bc htpasswd ${US} ${PS} 

pass: #docker方式生成htpaaswd # US=? PS=?
	docker run --rm --entrypoint htpasswd httpd:2 -Bbn ${US} ${PS} > htpasswd
